/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package javango.api;

import javango.core.RegUrl;
import javango.core.SubappUrl;

public final class UrlFactory {

    private UrlFactory() {}
    
    public static Url regUrl(String pattern, Class<?> clazz, String methodName) {
        return new RegUrl(pattern, clazz, methodName);
    }
    
	/**
	 * A {@link Url} that can have the following parameter types
	 * 
	 *  <digits> - any number
	 *  <string> - anything
	 */
    public static Url simpleUrl(String pattern, Class<?> clazz, String methodName) {
        return new RegUrl(pattern.replace("<digits>", "(\\d+)").replace("<string>", "(\\.+)"), 
                clazz, methodName);
    }
    
    public static Url subappUrl(String pattern, Class<? extends Urls> clazz) {
        return new SubappUrl(pattern, clazz);
    }
    
}
